//
//  InitDbTable.h
//  NursingManage
//
//  Created by Zhen Huang on 17/5/16.
//  Copyright © 2017年 James. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DBHelper.h"


#import <FMDB.h>
#import "Model_Pub_Employee.h"
#import "Model_Pub_Department_Nurse.h"
#import "Model_Pub_Dictionary_Item.h"

#import "Model_Hr_Scheduling.h"
#import "Model_Hr_Scheduling_Dept.h"
#import "Model_Hr_Atd_Scd_Group.h"

#import "Model_Hr_SatType.h"
#import "Model_Hr_SatCodeItem.h"
#import "Model_Hr_SatCode.h"
#import "Model_Hr_SatDept.h"

#import "HQcTypeModel.h"
#import "HQc_standardModel.h"
#import "HQc_codeModel.h"
#import "HQc_deptModel.h"
#import "Model_Hr_CodeReasonModel.h"

#import "Model_Hr_Quesbank_Type.h"
#import "Model_Hr_Question_Item.h"
#import "Model_Hr_Question_Type.h"
#import "Model_Hr_Qc_Spec.h"
#import "Model_Hr_Qc_Spec_Item.h"
#import "Model_Hr_InspectNew.h"

#import "Model_Hr_Param.h"
@interface InitDbTable : NSObject


+ (InitDbTable *)sharedFMDBManeger;


- (BOOL) createDbTable;



#pragma mark 1 职工档案表 & 护理单元 & 公用代码

- (void)insertPubEmployeeArray:(NSArray *)records;

- (void)deletePubEmployee;

- (void)insertPubDepartmentArray:(NSArray *)records;

- (void)deletePubDepartment;

- (void)deletePubDictionaryItem:(NSString *)dictId;

#pragma mark 2 科室排班 & 个人排班

- (void)insertHrScheduling:(NSArray *)HrScheduling scdGroup: (NSArray *)HrSchGroup schPeople:(NSArray*)HrSchPeople;

- (void)deleteHrScheduliing;

- (NSMutableArray *)DepartmentModel :(NSString *)string
                                    :(NSString *)week_begin
                                    :(NSString *)week_end;

- (NSMutableArray *)allModelSCDWithdate :(NSString *)emp_id
                                SCD_date:(NSString *)SCD_date
                             SCD_EndDATE:(NSString *)SCD_EndDate;

- (NSMutableArray *)ModelSCDWithdate :(NSString *)emp_id
                                SCD_date:(NSString *)SCD_date
                             SCD_EndDATE:(NSString *)SCD_EndDate
                               EMP_ID:(NSString *)EMP_ID;

#pragma mark 3 满意度调查

- (void)insertHrSatisfcation: (NSArray *)arrSaCode arrSaType: (NSArray *)arrSaType arrSaDept:(NSArray*)arrSaDept arrSaItem :(NSArray*)arrSaItem;

- (void)deleteHrSatisfcation;
#pragma mark 查找满意度调查 type

- (NSMutableArray *)GetHSatisfcation;

#pragma mark 查找满意度调查 code

- (NSMutableArray *)GetHSatisfcationCodeWithCodeID :(NSString *)type_id;

#pragma mark 判断满意度调查是不是末级 放区头

- (NSMutableArray *)GetHSatisfcationCodeWithParid :(NSString *)parid typeid:(NSString *)type_id;


#pragma mark 查找满意度调查 codeitem

- (NSMutableArray *)GetHSatisfcationItemWithGroupid :(NSString *)group_id;
#pragma mark 查找满意度对应的科室
- (NSMutableArray *)GetHSatisfcationDepartWithTypeID:(NSString * )Type_id;
#pragma mark 满意度调查科室搜索
-(NSMutableArray *) GetHSatisfcationDepartWithTypeID:(NSString *)standard_id input_Code:(NSString *)input_Code;

#pragma mark 4 质量检查 & 夜查房 等等

- (void)insertHrQuality: (NSArray *)arrQcCode
              arrQcType: (NSArray *)arrQcType
          arrQcStandard:(NSArray*)arrQcStandard
              arrQcDept:(NSArray*)arrQcDept
             arrQcDict :(NSArray*)arrQcDict
                arrspec:(NSArray *)arrspec
           arrspec_item:(NSArray *)arrspec_item
              arreasons:(NSArray *)arreasons;

- (void)deleteHrQuality;

//删除参数表中的数据
- (void)deleteHrParam;

#pragma 创建qc_type表

- (NSMutableArray *)Qc_type;

- (NSInteger)QC_TypeCount;

#pragma 创建qc_standard表


- (void)createQc_standardTable;

- (NSMutableArray *)Qc_standardWithTYPE_ID:(NSString *)TYPE_ID;

#pragma 创建qc_code表

- (NSMutableArray *)Qc_code:(NSString *)type_id
                STANDARD_ID:(NSString *)STANDARD_ID
                     par_id:(NSString *)par_id;

- (NSMutableArray *)Qc_code:(NSString *)type_id
                STANDARD_ID:(NSString *)STANDARD_ID
                     par_id:(NSString *)par_id
                       code:(NSString *)code;

- (NSMutableArray *)Qc_codeDetail:(NSString *)type_id
                      STANDARD_ID:(NSString *)STANDARD_ID
                           par_id:(NSString *)par_id;


- (NSMutableArray *)change:(NSString *)type_id;

#pragma 创建qc_dept表


- (NSMutableArray *)Qc_dept;

- (HQc_deptModel *)GetQc_deptWithDept_id:(NSString *)dept_id;


#pragma 创建考试表

- (void)inserttest: (NSArray *)arrQuebankArray
         arrSaType: (NSArray *)arrQuetype;

- (void)insertarrSaItem: (NSArray *)arrQueItem;


- (void)deleteTest;

- (void)deleteTestWithBankid:(NSArray *)array;

- (NSMutableArray *)questype:(NSArray *)array;
#pragma mark 新增质量检查指标

- (NSMutableArray *)code_content:(NSString *)code_id;

#pragma mark 新增质量检查指标检查项

- (NSMutableArray *)code_cotent_item:(NSString *)code_id;

#pragma mark 新增质量指标保存

- (void)insetInspectNew:(NSArray *)array;

#pragma mark 修改质量指标
- (void)updateInspectNew:(NSArray *)array;


- (void)deleteInspectNew:(NSArray *)array;


-(NSArray *)getWeekWithTime:(NSString *)time ;


//质量检查 点击保存,查找主表的分数和扣分原因

- (NSString *)getMainScore:(NSString *)result_id;

- (NSString *)getMainReason:(NSString *)result_id;

- (NSString *)getMainReasonID:(NSString *)result_id;

//质量检查判断是否已经填写过
- (NSMutableArray *)getPar_id:(NSString *)result_id
            check_flag:(NSInteger)check_flag;


#pragma mark 更新参数

-(void) insertParam:(NSArray *)paramArray;

- (NSMutableArray *)getParam;

@end
